package sword_to_1;

import java.util.HashSet;
import java.util.Set;

public class LeeCode_50 {
    public static void main(String[] args) {

    }
    private static char firstUniqChar(String s) {
        Set<Character> set = new HashSet<>();
        Set<Character> set2 = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (set.contains(c)){
                set2.add(c);
            }
            set.add(c);
        }
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (!set2.contains(c)){
                return c;
            }
        }
        return ' ';
    }
}
